<script>
	import HttpApi from '@/api/httpApi';
	// #ifdef H5
	import h5PageAnimation from './components/h5-page-animation/';
	// #endif
	export default {
		// #ifdef H5
		mixins: [h5PageAnimation],
		// #endif
		onLaunch: function() {
			const lang = uni.getStorageSync('hhh-lang')
			if (!lang) {
				// 设置默认语言
				uni.setStorageSync('hhh-lang', 'en')
				uni.setLocale("en")
			}
			console.log('App Launch')
			const windinfo = uni.getWindowInfo()
			uni.setStorageSync('windinfo', windinfo)
			console.log(windinfo)
			this.$store.commit('setBottom', windinfo.safeAreaInsets.bottom)


			const token = uni.getStorageSync('hhh-token')
			if (token) {
				this.$store.commit('setToken', token)
				this.userInfo()
			}
			this.setTabbarLang()

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			userInfo() {
				HttpApi.userInfo().then(res => {
					if (res.code === 1) {
						this.$store.commit('setUser', res.data)
					}
				})
			}
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import '@/style/free.css';
	@import '@/style/common.scss';
	@import '@/style/size.css';
	@import '@/style/color.css';
</style>